package com.qf.voterabbitmqcustomer.handler;

import com.qf.voterabbitmqcustomer.vo.ResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author 刘欣
 * @createTime 2023/3/2 15:12
 * @description 全局异常处理器
 */
@RestControllerAdvice
@Slf4j
public class ExHandler {


    @ExceptionHandler(Exception.class)
    public ResultVo exception(Exception ex) {
        log.debug("系统异常ex={}", ex.getMessage());
        return ResultVo.error(ex.getMessage());
    }
}
